package com.kwlt.smc.dao;

import java.util.List;

import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

import com.kwlt.smc.entity.User;


/**
 * 用户DAO类
 * @author xushunxin
 *
 */
public interface UserDao extends JpaRepository<User, Long> {
	
	@Query("select u from User u where u.loginName = :loginName and u.password=:password and u.status='A' ")
	User findByLoginNamePassword(@Param("loginName")String loginName,@Param("password")String password);
	
	@Query("select u from User u where u.userNumbers = :userNumbers")
	User findByUserNumbers(@Param("userNumbers")String userNumbers);
	
	@Query("select u from User u where u.status='A' and u.expaCode is not null and u.expaCode !='' and u.smsUpCallbackAddr is not null and u.smsUpCallbackAddr!='' ")
	List<User> findAllUserForMO();
	
	@Query("select u from User u where u.status='A' ")
	List<User> findAllUser();
	
	@Query("select u from User u where u.loginName=:loginName and u.status!='X' ")
	User findByLoginName(@Param("loginName")String loginName);
}
